"use strict";
function _classCallCheck(e, t) {
    if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
var _createClass = function() {
    function e(e, t) {
        for (var n = 0; n < t.length; n++) {
            var i = t[n];
            i.enumerable = i.enumerable || !1,
            i.configurable = !0,
            "value" in i && (i.writable = !0),
            Object.defineProperty(e, i.key, i)
        }
    }
    return function(t, n, i) {
        return n && e(t.prototype, n),
        i && e(t, i),
        t
    }
} (); !
function(e, t) {
    function n(e, n, i, o, r, a, s, l, c, u, f) {
        var d = n.getInstance("NodeService"),
        h = function() {
            var t = "/api/deploy";
            this.getList = function() {
                return e.get(t + "/list")
            },
            this.getListByCollectionId = function(n) {
                return e.get(t + "/list/" + n)
            },
            this.getSingle = function(n) {
                return e.get(t + "/id/" + n)
            },
            this.modifyDeploy = function(n, i) {
                return e.put(t + "/id/" + n, angular.toJson(i))
            },
            this.getEvents = function(n) {
                return e.get(t + "/event/list?deployId=" + n)
            },
            this.getInstances = function(n) {
                return e.get(t + "/" + n + "/instance")
            },
            this.getVersions = function(t) {
                return e.get("/api/version/list?deployId=" + t)
            },
            this.getSingleVersion = function(t, n) {
                return e.get("/api/version/id/" + t + "/" + n)
            },
            this.createVersion = function(t) {
                return e.post("/api/version/create?deployId=" + t.deployId, angular.toJson(t))
            },
            this.createWatcherVersion = function(t) {
                return e.post("/api/version/create?deployId=" + t.deployId, angular.toJson(t))
            },
            this.rollbackDeploy = function(t, n, i) {
                return i ? e.post("/api/deploy/action/rollback?deployId=" + t + "&version=" + n + "&replicas=" + i) : e.post("/api/deploy/action/rollback?deployId=" + t + "&version=" + n)
            },
            this.updateDeploy = function(t, n, i) {
                return i ? e.post("/api/deploy/action/update?deployId=" + t + "&version=" + n + "&replicas=" + i) : e.post("/api/deploy/action/update?deployId=" + t + "&version=" + n)
            },
            this.startDeploy = function(t, n, i) {
                return i ? e.post("/api/deploy/action/start?deployId=" + t + "&version=" + n + "&replicas=" + i) : e.post("/api/deploy/action/start?deployId=" + t + "&version=" + n)
            }
        },
        v = new h,
        y = function() {
            function a(e) {
                _classCallCheck(this, a),
                this.collectionId = "",
                this.namespaceList = [],
                this.isNewNamespace = !1,
                this.imageList = null,
                this.envList = [{
                    value: "TEST",
                    text: "测试环境"
                },
                {
                    value: "PROD",
                    text: "生产环境"
                }],
                this.valid = {
                    ips: !1
                },
                this.logConfig = null,
                this.envText = "请选择部署环境",
                this.versionList = null,
                this.nodeListIns = n.getInstance("NodeList"),
                this.nodeListForIps = [],
                this.clusterListIns = n.getInstance("ClusterList"),
                this.loadingIns = o.getLoadingInstance(),
                this.creator = {
                    id: null,
                    name: null,
                    type: null
                },
                this.visitMode = "noAccess",
                this.hostEnv = "TEST",
                this.config = {},
                this.defaultVersionString = {
                    YAML: 'containers:\n- image: "pub.domeos.org/registry:2.3"\n  name: "test-container"\n  volumeMounts:\n  - mountPath: "/test-hostpath"\n    name: "test-volume"\nvolumes:\n- hostPath:\n    path: "/opt/scs"\n  name: "test-volume"\n',
                    JSON: '{\n  "containers": [{\n    "image": "pub.domeos.org/registry:2.3",\n    "name": "test-container",\n    "volumeMounts": [{\n      "mountPath": "/test-hostpath",\n      "name": "test-volume"\n    }]\n  }],\n  "volumes": [{\n    "hostPath": {\n      "path": "/opt/scs"\n    },\n    "name": "test-volume"\n  }]\n}\n'
                },
                this.mountVolumeType = {
                    HOSTPATH: "主机目录",
                    EMPTYDIR: "实例内目录"
                },
                this.storageVolumeConsole = [],
                this.init(e)
            }
            return _createClass(a, [{
                key: "init",
                value: function(e) {
                    var n = this,
                    i = void 0,
                    o = void 0,
                    r = -1;
                    c.isObject(e) || (e = {}),
                    e.deploymentType || (e.deploymentType = "DEPLOYMENT"),
                    e.volumeDrafts || (e.volumeDrafts = []),
                    e.versionType || (e.versionType = "CUSTOM"),
                    "YAML" !== e.versionType && "JSON" !== e.versionType || (e.versionString = e.versionString || {},
                    e.versionString.podSpec = e.versionString.padSpec || ""),
                    "number" != typeof e.replicas && (e.replicas = 3),
                    c.isArray(e.loadBalanceDrafts) || (e.loadBalanceDrafts = []),
                    c.isArray(e.innerServiceDrafts) || (e.innerServiceDrafts = []),
                    c.isArray(e.currentVersions) || (e.currentVersions = []);
                    var a = !0,
                    s = !1,
                    l = t;
                    try {
                        for (var u, f = e.loadBalanceDrafts[Symbol.iterator](); ! (a = (u = f.next()).done); a = !0) {
                            var d = u.value;
                            d.externalIPs || (d.externalIPs = []);
                            var h = [],
                            y = !0,
                            g = !1,
                            p = t;
                            try {
                                for (var m, I = d.externalIPs[Symbol.iterator](); ! (y = (m = I.next()).done); y = !0) {
                                    var k = m.value;
                                    h.push({
                                        ip: k
                                    })
                                }
                            } catch(e) {
                                g = !0,
                                p = e
                            } finally {
                                try { ! y && I.
                                    return && I.
                                    return ()
                                } finally {
                                    if (g) throw p
                                }
                            }
                            h.push({
                                ip: ""
                            }),
                            d.externalIPs = h
                        }
                    } catch(e) {
                        s = !0,
                        l = e
                    } finally {
                        try { ! a && f.
                            return && f.
                            return ()
                        } finally {
                            if (s) throw l
                        }
                    }
                    if (this.config = e, this.addLoadBalance(), this.addInnerService(), this.config.networkMode || (this.config.networkMode = "DEFAULT"), this.config.accessType || (this.config.accessType = "K8S_SERVICE"), i = this.config.currentVersions, this.config.deployId) {
                        null === this.versionList && (this.loadingIns.startLoading("versions"), v.getVersions(this.config.deployId).then(function(e) {
                            n.versionList = e.data.result || [],
                            0 === i.length && c.isObject(n.versionList[0]) && n.toggleVersion(n.versionList[0].version)
                        }).
                        finally(function() {
                            n.loadingIns.finishLoading("versions")
                        }));
                        for (var C = 0,
                        L = i.length; C < L; C++) i[C].createTime > r && (r = i[C].createTime, o = i[C].version);
                        void 0 !== o && this.toggleVersion(o)
                    } else this.initData()
                }
            },
            {
                key: "initData",
                value: function() {
                    var e = this;
                    if (c.isArray(this.config.containerConsoles) || (this.config.containerConsoles = []), c.isArray(this.config.labelSelectors) || (this.config.labelSelectors = []), this.initSelectedLabels(), this.config.hostEnv) {
                        var n = !0,
                        o = !1,
                        r = t;
                        try {
                            for (var a, s = this.envList[Symbol.iterator](); ! (n = (a = s.next()).done); n = !0) {
                                var l = a.value;
                                if (this.config.hostEnv === l.value) {
                                    this.toggleEnv(l);
                                    break
                                }
                            }
                        } catch(e) {
                            o = !0,
                            r = e
                        } finally {
                            try { ! n && s.
                                return && s.
                                return ()
                            } finally {
                                if (o) throw r
                            }
                        }
                    } else this.toggleEnv(this.envList[0]);
                    this.config.stateful !== !0 && (c.isArray(this.imageList) || "WATCHER" === this.config.versionType ? this.formartcontainerConsoles() : (this.loadingIns.startLoading("dockerImage"), i.imageService.getProjectImages().then(function(n) {
                        var i = n.data.result || [],
                        o = !0,
                        r = !1,
                        a = t;
                        try {
                            for (var s, l = i[Symbol.iterator](); ! (o = (s = l.next()).done); o = !0) {
                                var c = s.value,
                                u = [];
                                if (c.envSettings) {
                                    var f = !0,
                                    d = !1,
                                    h = t;
                                    try {
                                        for (var v, y = c.envSettings[Symbol.iterator](); ! (f = (v = y.next()).done); f = !0) {
                                            var g = v.value;
                                            u.push({
                                                key: g.key,
                                                value: g.value,
                                                description: g.description
                                            })
                                        }
                                    } catch(e) {
                                        d = !0,
                                        h = e
                                    } finally {
                                        try { ! f && y.
                                            return && y.
                                            return ()
                                        } finally {
                                            if (d) throw h
                                        }
                                    }
                                }
                                c.envSettings = u
                            }
                        } catch(e) {
                            r = !0,
                            a = e
                        } finally {
                            try { ! o && l.
                                return && l.
                                return ()
                            } finally {
                                if (r) throw a
                            }
                        }
                        e.imageList = i,
                        e.formartcontainerConsoles()
                    }).
                    finally(function() {
                        e.loadingIns.finishLoading("dockerImage")
                    })));
                    var u = !0,
                    f = !1,
                    d = t;
                    try {
                        for (var h, v = this.config.containerConsoles[Symbol.iterator](); ! (u = (h = v.next()).done); u = !0) {
                            var y = h.value;
                            this.addLogDraft(y),
                            this.linkVolumeMountToVolume(y, this.config.volumeDrafts)
                        }
                    } catch(e) {
                        f = !0,
                        d = e
                    } finally {
                        try { ! u && v.
                            return && v.
                            return ()
                        } finally {
                            if (f) throw d
                        }
                    }
                }
            },
            {
                key: "setCollectionId",
                value: function(e) {
                    this.collectionId = e
                }
            },
            {
                key: "initCluster",
                value: function() {
                    var e = this;
                    return this.loadingIns.startLoading("cluster"),
                    d.getData().then(function(t) {
                        e.clusterListIns.init(t.data.result),
                        e.toggleCluster()
                    }).
                    finally(function() {
                        e.loadingIns.finishLoading("cluster")
                    })
                }
            },
            {
                key: "freshDeploy",
                value: function(e) {
                    c.isObject(e) && (this.config.lastUpdateTime = e.lastUpdateTime, this.config.deploymentStatus = e.deploymentStatus, this.config.currentVersions = e.currentVersions, this.config.currentReplicas = e.currentReplicas)
                }
            },
            {
                key: "freshVersionList",
                value: function() {
                    var e = this;
                    this.loadingIns.startLoading("versionList"),
                    v.getVersions(this.config.deployId).then(function(t) {
                        e.versionList = t.data.result || []
                    }).
                    finally(function() {
                        e.loadingIns.finishLoading("versionList")
                    })
                }
            },
            {
                key: "toggleCluster",
                value: function(e) {
                    var n = this,
                    i = void 0,
                    o = this.clusterListIns.clusterList;
                    if (0 !== o.length) {
                        if (void 0 === e) {
                            for (var r = 0,
                            a = o.length; r < a; r++) if (o[r].id === this.config.clusterId) {
                                e = r;
                                break
                            }
                            void 0 === e && (e = 0)
                        }
                        this.clusterListIns.toggleCluster(e),
                        this.logConfig = o[e].logConfig,
                        i = this.clusterListIns.cluster.id,
                        this.initStorageVolumeList(i),
                        this.loadingIns.startLoading("nodelist"),
                        d.getNodeList(i).then(function(e) {
                            var i = e.data.result || [];
                            n.nodeListForIps = angular.copy(i);
                            for (var o = 0; o < n.nodeListForIps.length; o++) {
                                var r = n.nodeListForIps[o];
                                if ("Ready" == r.status) {
                                    var a = n.config.loadBalanceDrafts[0].externalIPs,
                                    s = !0,
                                    l = !1,
                                    c = t;
                                    try {
                                        for (var u, f = a[Symbol.iterator](); ! (s = (u = f.next()).done); s = !0) {
                                            if (u.value === r.ip) {
                                                r.isSelected = !0;
                                                break
                                            }
                                        }
                                    } catch(e) {
                                        l = !0,
                                        c = e
                                    } finally {
                                        try { ! s && f.
                                            return && f.
                                            return ()
                                        } finally {
                                            if (l) throw c
                                        }
                                    }
                                    void 0 === r.isSelected && (r.isSelected = !1)
                                } else n.nodeListForIps.splice(o, 1),
                                o--
                            }
                            if (n.nodeListIns.init(i, n.config.stateful), n.initSelectedLabels(), n.nodeListIns.toggleEnv(n.config.hostEnv), n.config.stateful && n.config.replicas && n.nodeListIns.nodeList) for (var d = 0,
                            h = n.nodeListIns.nodeList.length; d < h && d < n.config.replicas; d++) n.nodeListIns.nodeList[d].isSelected = !0,
                            n.nodeListIns.toggleNodeCheck(n.nodeListIns.nodeList[d])
                        },
                        function() {
                            n.nodeListIns.init()
                        }).
                        finally(function() {
                            n.loadingIns.finishLoading("nodelist")
                        }),
                        void 0 === this.config.deployId && (this.loadingIns.startLoading("namespace"), d.getNamespace(i).then(function(e) {
                            n.namespaceList = e.data.result || [],
                            n.isNewNamespace = !1,
                            n.config.namespace = n.namespaceList[0].name || null;
                            for (var t = 0,
                            i = n.namespaceList.length; t < i; t++) if ("default" == n.namespaceList[t].name) {
                                n.config.namespace = n.namespaceList[t].name;
                                break
                            }
                        },
                        function() {
                            n.isNewNamespace = !1,
                            n.namespaceList = [],
                            n.config.namespace = null
                        }).
                        finally(function() {
                            n.loadingIns.finishLoading("namespace")
                        }))
                    }
                }
            },
            {
                key: "initSelectedLabels",
                value: function() {
                    if (this.nodeListIns.initLabelsInfo(), this.config.labelSelectors) {
                        var e = this.config.labelSelectors,
                        n = !0,
                        i = !1,
                        o = t;
                        try {
                            for (var r, a = e[Symbol.iterator](); ! (n = (r = a.next()).done); n = !0) {
                                var s = r.value,
                                l = s.name;
                                "kubernetes.io/hostname" != l && "TESTENV" != l && "PRODENV" != l && this.nodeListIns.toggleLabel(l, !0)
                            }
                        } catch(e) {
                            i = !0,
                            o = e
                        } finally {
                            try { ! n && a.
                                return && a.
                                return ()
                            } finally {
                                if (i) throw o
                            }
                        }
                    }
                }
            },
            {
                key: "validIps",
                value: function() {
                    if ("foreign" === this.visitMode) {
                        var e = !0,
                        n = !1,
                        i = t;
                        try {
                            for (var o, r = this.nodeListForIps[Symbol.iterator](); ! (e = (o = r.next()).done); e = !0) {
                                if (o.value.isSelected) return void(this.valid.ips = !0)
                            }
                        } catch(e) {
                            n = !0,
                            i = e
                        } finally {
                            try { ! e && r.
                                return && r.
                                return ()
                            } finally {
                                if (n) throw i
                            }
                        }
                        this.valid.ips = !1
                    } else this.valid.ips = !0
                }
            },
            {
                key: "toggleVersion",
                value: function(e) {
                    var t = this;
                    this.loadingIns.startLoading("toggleVersion"),
                    v.getSingleVersion(this.config.deployId, e).then(function(e) {
                        c.isObject(e.data.result) && ($.extend(t.config, e.data.result), t.initData())
                    }).
                    finally(function() {
                        t.loadingIns.finishLoading("toggleVersion")
                    })
                }
            },
            {
                key: "formartcontainerConsoles",
                value: function() {
                    for (var e = this,
                    t = this.config.containerConsoles,
                    n = 0,
                    o = t.length; n < o; n++) {
                        t[n].oldEnv = [],
                        t[n].newEnv = [],
                        function(t) {
                            e.loadingIns.startLoading("tag"),
                            i.imageService.getImageTags(t.image, t.registry).then(function(e) {
                                t.tagList = e.data.result || []
                            }).
                            finally(function() {
                                e.loadingIns.finishLoading("tag")
                            })
                        } (t[n]);
                        for (var r = [], a = 0, s = this.imageList.length; a < s; a++) if (this.imageList[a].imageName === t[n].image) {
                            r = this.imageList[a].envSettings;
                            break
                        }
                        if (t[n].envs) for (var l = 0,
                        c = t[n].envs.length; l < c; l++) {
                            for (var u = !1,
                            f = 0,
                            d = r.length; f < d; f++) if (r[f].key === t[n].envs[l].key) {
                                u = !0;
                                break
                            }
                            u ? t[n].oldEnv.push(t[n].envs[l]) : t[n].newEnv.push(t[n].envs[l])
                        } else t[n].oldEnv = angular.copy(r)
                    }
                }
            },
            {
                key: "changeVisitModeToValid",
                value: function() {
                    var e = [];
                    e.push("noAccess"),
                    "HOST" === this.config.networkMode && e.push("access"),
                    "DEFAULT" === this.config.networkMode && e.push("internal", "foreign"),
                    e.indexOf(this.visitMode) === -1 && (this.visitMode = e[0])
                }
            },
            {
                key: "toggleNamespace",
                value: function(e) {
                    this.config.namespace = e
                }
            },
            {
                key: "toggleIsNewNamespace",
                value: function() {
                    this.isNewNamespace = !this.isNewNamespace,
                    this.config.namespace = null
                }
            },
            {
                key: "toggleEnv",
                value: function(e) {
                    this.config.hostEnv = e.value,
                    this.envText = e.text,
                    this.nodeListIns.toggleEnv(e.value)
                }
            },
            {
                key: "toggleCreator",
                value: function(e) {
                    this.creator = e
                }
            },
            {
                key: "toggleVolumeType",
                value: function(e, t) {
                    e.volumeType = t
                }
            },
            {
                key: "toggleStorageVolumeReadonly",
                value: function(e, t) {
                    e.volumePVC.readOnly = t
                }
            },
            {
                key: "toggleStorageVolumeName",
                value: function(e, t) {
                    e.volumePVC.volumeId = t.storageVolumeDraft.id,
                    e.volumePVC.volumeName = t.storageVolumeDraft.name,
                    e.volumePVC.claimName = t.storageVolumeDraft.name
                }
            },
            {
                key: "deleteVolumeDraft",
                value: function(e, t) {
                    var n = this.config.volumeDrafts,
                    i = n.indexOf(e);
                    n.splice(i, 1),
                    this.deleteVolumeMountDraftByVolume(e, t)
                }
            },
            {
                key: "addVolumeDraft",
                value: function() {
                    this.config.volumeDrafts = this.config.volumeDrafts || [],
                    this.config.volumeDrafts.push({
                        name: "",
                        volumeType: "HOSTPATH",
                        hostPath: "",
                        emptyDir: "",
                        volumePVC: {
                            claimName: "",
                            readOnly: !1,
                            volumeId: null,
                            volumeName: null
                        }
                    })
                }
            },
            {
                key: "toggleImageTag",
                value: function(e, t) {
                    this.config.containerConsoles[e].tag = t
                }
            },
            {
                key: "addImage",
                value: function(e) {
                    var t = this;
                    this.loadingIns.startLoading("addImage"),
                    i.imageService.getImageTags(e.imageName, e.registry).then(function(n) {
                        var i = n.data.result;
                        t.config.containerConsoles.push({
                            image: e.imageName,
                            registry: e.registry,
                            cpu: .5,
                            mem: 1024,
                            tag: i && i[0] ? i[0].tag: void 0,
                            tagList: i || [],
                            oldEnv: e.envSettings || [],
                            newEnv: [],
                            healthChecker: {
                                type: "NONE"
                            },
                            imagePullPolicy: "Always",
                            autoDeploy: !1,
                            logItemDrafts: [{
                                logPath: "",
                                autoCollect: !1,
                                autoDelete: !1
                            }],
                            volumeMountDrafts: []
                        })
                    }).
                    finally(function() {
                        t.loadingIns.finishLoading("addImage")
                    })
                }
            },
            {
                key: "addOtherImage",
                value: function() {
                    var e = this;
                    s.open({
                        animation: !0,
                        templateUrl: "/index/tpl/modal/otherImageModal/otherImageModal.html",
                        controller: "OtherImageModalCtr",
                        size: "md"
                    }).result.then(function(t) {
                        e.config.containerConsoles.push({
                            image: t.name,
                            registry: t.registry,
                            cpu: .5,
                            mem: 1024,
                            tag: t.tag,
                            tagList: [{
                                tag: t.tag
                            }],
                            oldEnv: [],
                            newEnv: [],
                            healthChecker: {
                                type: "NONE"
                            },
                            imagePullPolicy: "Always",
                            autoDeploy: !1,
                            logItemDrafts: [{
                                logPath: "",
                                autoCollect: !1,
                                autoDelete: !1
                            }]
                        })
                    })
                }
            },
            {
                key: "deleteImage",
                value: function(e) {
                    this.config.containerConsoles.splice(e, 1)
                }
            },
            {
                key: "addImageEnv",
                value: function(e) {
                    this.config.containerConsoles[e].newEnv.push({
                        key: "",
                        value: "",
                        description: ""
                    })
                }
            },
            {
                key: "deleteImageEnv",
                value: function(e, t) {
                    this.config.containerConsoles[e].newEnv.splice(t, 1)
                }
            },
            {
                key: "addLoadBalance",
                value: function() {
                    this.config.loadBalanceDrafts.push({
                        port: "",
                        targetPort: "",
                        externalIPs: [{
                            ip: ""
                        }]
                    })
                }
            },
            {
                key: "addInnerService",
                value: function() {
                    this.config.innerServiceDrafts.push({
                        port: "",
                        targetPort: ""
                    })
                }
            },
            {
                key: "addExternalIPs",
                value: function(e) {
                    this.config.loadBalanceDrafts[e].externalIPs.push({
                        ip: ""
                    })
                }
            },
            {
                key: "deleteExternalIPs",
                value: function(e, t) {
                    this.config.loadBalanceDrafts[e].externalIPs.splice(t, 1)
                }
            },
            {
                key: "addLogDraft",
                value: function(e) {
                    e.logItemDrafts = e.logItemDrafts || [],
                    e.logItemDrafts.push({
                        logPath: "",
                        autoCollect: !1,
                        autoDelete: !1
                    })
                }
            },
            {
                key: "linkVolumeMountToVolume",
                value: function(e, t) {
                    e.volumeMountDrafts = e.volumeMountDrafts || [],
                    e.volumeMountDrafts = e.volumeMountDrafts.filter(function(e) {
                        var n = t.filter(function(t) {
                            return t.name === e.name
                        })[0];
                        if (n) return e._volume = n,
                        !0
                    })
                }
            },
            {
                key: "addVolumeMountDraft",
                value: function(e) {
                    e.volumeMountDrafts = e.volumeMountDrafts || [],
                    e.volumeMountDrafts.push({
                        name: "",
                        readOnly: !1,
                        mountPath: "",
                        subPath: "",
                        _volume: null
                    })
                }
            },
            {
                key: "deleteVolumeMountDraft",
                value: function(e, t) {
                    e.volumeMountDrafts = e.volumeMountDrafts || [],
                    e.volumeMountDrafts = e.volumeMountDrafts.filter(function(e) {
                        return e !== t
                    })
                }
            },
            {
                key: "deleteVolumeMountDraftByVolume",
                value: function(e, t) {
                    t.forEach(function(t) {
                        t.volumeMountDrafts = t.volumeMountDrafts || [],
                        t.volumeMountDrafts = t.volumeMountDrafts.filter(function(t) {
                            return t._volume !== e
                        })
                    })
                }
            },
            {
                key: "updateVolumeMountName",
                value: function(e, t) {
                    t.forEach(function(t) {
                        t.volumeMountDrafts = t.volumeMountDrafts || [],
                        t.volumeMountDrafts.forEach(function(t) {
                            t._volume === e && (t.name = e.name)
                        })
                    })
                }
            },
            {
                key: "toggleVolumeMountReadonly",
                value: function(e, t) {
                    e.readOnly = t
                }
            },
            {
                key: "toggleVolumeMountName",
                value: function(e, t) {
                    e.name = t.name,
                    e._volume = t
                }
            },
            {
                key: "deleteLogDraft",
                value: function(e, t) {
                    e.logItemDrafts.splice(e.logItemDrafts.indexOf(t), 1)
                }
            },
            {
                key: "deleteArrItem",
                value: function(e, t) {
                    this.config[e].splice(t, 1)
                }
            },
            {
                key: "formartHealthChecker",
                value: function() {
                    if ("HOST" == this.config.networkMode) {
                        var e = !0,
                        n = !1,
                        i = t;
                        try {
                            for (var o, r = this.config.containerConsoles[Symbol.iterator](); ! (e = (o = r.next()).done); e = !0) {
                                o.value.healthChecker = {
                                    type: "NONE"
                                }
                            }
                        } catch(e) {
                            n = !0,
                            i = e
                        } finally {
                            try { ! e && r.
                                return && r.
                                return ()
                            } finally {
                                if (n) throw i
                            }
                        }
                    }
                }
            },
            {
                key: "changeNetworkmode",
                value: function() {
                    if ("HOST" == this.config.networkMode) {
                        var e = !0,
                        n = !1,
                        i = t;
                        try {
                            for (var o, r = this.config.loadBalanceDrafts[Symbol.iterator](); ! (e = (o = r.next()).done); e = !0) {
                                var a = o.value;
                                a.port = a.targetPort
                            }
                        } catch(e) {
                            n = !0,
                            i = e
                        } finally {
                            try { ! e && r.
                                return && r.
                                return ()
                            } finally {
                                if (n) throw i
                            }
                        }
                    }
                }
            },
            {
                key: "changeTargetPort",
                value: function(e) {
                    this.config.loadBalanceDrafts[e].port = this.config.loadBalanceDrafts[e].targetPort
                }
            },
            {
                key: "_formartDeploy",
                value: function() {
                    var e = this,
                    n = angular.copy(this.config);
                    return "HOST" == n.networkMode ? (n.loadBalanceDrafts = [], n.accessType = "DIY", n.innerServiceDrafts = [], "noAccess" == this.visitMode && (n.exposePortNum = 0)) : (n.exposePortNum = 0, "noAccess" == this.visitMode ? (n.accessType = "DIY", n.loadBalanceDrafts = [], n.innerServiceDrafts = []) : "internal" == this.visitMode ? (n.accessType = "K8S_SERVICE", n.innerServiceDrafts[0].targetPort = n.innerServiceDrafts[0].port, n.loadBalanceDrafts = []) : (n.accessType = "K8S_SERVICE", n.innerServiceDrafts = [])),
                    n.loadBalanceDrafts = function() {
                        var i = [],
                        o = [],
                        r = !0,
                        a = !1,
                        s = t;
                        try {
                            for (var l, c = e.nodeListForIps[Symbol.iterator](); ! (r = (l = c.next()).done); r = !0) {
                                var u = l.value;
                                u.isSelected && i.push(u.ip)
                            }
                        } catch(e) {
                            a = !0,
                            s = e
                        } finally {
                            try { ! r && c.
                                return && c.
                                return ()
                            } finally {
                                if (a) throw s
                            }
                        }
                        var f = !0,
                        d = !1,
                        h = t;
                        try {
                            for (var v, y = n.loadBalanceDrafts[Symbol.iterator](); ! (f = (v = y.next()).done); f = !0) {
                                var g = v.value;
                                g.port && (g.externalIPs = i, o.push(g))
                            }
                        } catch(e) {
                            d = !0,
                            h = e
                        } finally {
                            try { ! f && y.
                                return && y.
                                return ()
                            } finally {
                                if (d) throw h
                            }
                        }
                        return o
                    } (),
                    n.stateful ? n.hostList = this.nodeListIns.getSelectedNodes() : n.labelSelectors = this.nodeListIns.getFormartSelectedLabels(),
                    n.clusterId = this.clusterListIns.cluster.id,
                    n.collectionId = this.collectionId,
                    "CUSTOM" === n.versionType ? n.containerConsoles = function() {
                        if (n.stateful) return n.containerConsoles;
                        if (n.containerConsoles) {
                            var e = void 0,
                            i = [],
                            o = void 0,
                            r = !0,
                            a = !1,
                            s = t;
                            try {
                                for (var l, c = n.containerConsoles[Symbol.iterator](); ! (r = (l = c.next()).done); r = !0) {
                                    var u = l.value;
                                    e = u.oldEnv,
                                    u.healthChecker || (u.healthChecker = {
                                        type: "NONE"
                                    }),
                                    o = {
                                        type: u.healthChecker.type
                                    },
                                    "HOST" != n.networkMode ? ("TCP" != o.type && "HTTP" != o.type || (o.port = u.healthChecker.port, o.timeout = u.healthChecker.timeout, o.delay = u.healthChecker.delay), "HTTP" == o.type && (o.url = u.healthChecker.url)) : o.type = "NONE";
                                    var f = !0,
                                    d = !1,
                                    h = t;
                                    try {
                                        for (var v, y = u.newEnv[Symbol.iterator](); ! (f = (v = y.next()).done); f = !0) {
                                            var g = v.value;
                                            "" !== g.key && e.push(g)
                                        }
                                    } catch(e) {
                                        d = !0,
                                        h = e
                                    } finally {
                                        try { ! f && y.
                                            return && y.
                                            return ()
                                        } finally {
                                            if (d) throw h
                                        }
                                    }
                                    var p = function(e) {
                                        var n = [],
                                        i = !0,
                                        o = !1,
                                        r = t;
                                        try {
                                            for (var a, s = e[Symbol.iterator](); ! (i = (a = s.next()).done); i = !0) {
                                                var l = a.value;
                                                if ("" !== l.logPath) {
                                                    var c = {
                                                        logPath: l.logPath,
                                                        autoCollect: l.autoCollect,
                                                        autoDelete: l.autoDelete
                                                    };
                                                    l.autoCollect && (c.logTopic = l.logTopic, c.processCmd = l.processCmd),
                                                    l.autoDelete && (c.logExpired = l.logExpired),
                                                    n.push(c)
                                                }
                                            }
                                        } catch(e) {
                                            o = !0,
                                            r = e
                                        } finally {
                                            try { ! i && s.
                                                return && s.
                                                return ()
                                            } finally {
                                                if (o) throw r
                                            }
                                        }
                                        return 0 === n.length ? null: n
                                    } (u.logItemDrafts),
                                    m = function(e) {
                                        return e.map(function(e) {
                                            return {
                                                name: e.name,
                                                readOnly: e.readOnly,
                                                mountPath: e.mountPath,
                                                subPath: e.subPath
                                            }
                                        }).filter(function(e) {
                                            return e.name
                                        })
                                    } (u.volumeMountDrafts || []);
                                    i.push({
                                        image: u.image,
                                        registry: u.registry,
                                        tag: u.tag,
                                        cpu: u.cpu,
                                        mem: u.mem,
                                        logItemDrafts: p,
                                        envs: e,
                                        healthChecker: o,
                                        imagePullPolicy: u.imagePullPolicy,
                                        autoDeploy: u.autoDeploy,
                                        volumeMountDrafts: m
                                    })
                                }
                            } catch(e) {
                                a = !0,
                                s = e
                            } finally {
                                try { ! r && c.
                                    return && c.
                                    return ()
                                } finally {
                                    if (a) throw s
                                }
                            }
                            return i
                        }
                    } () : "JSON" !== n.versionType && "YAML" !== n.versionType || n.versionString && (n.podSpecStr = n.versionString.podSpecStr, delete n.versionString),
                    n
                }
            },
            {
                key: "createVersion",
                value: function(e) {
                    var t = this,
                    n = l.defer(),
                    i = this._formartDeploy(),
                    o = {
                        deployId: i.deployId,
                        containerConsoles: i.containerConsoles,
                        labelSelectors: i.labelSelectors,
                        versionType: i.versionType,
                        podSpecStr: i.podSpecStr,
                        volumeDrafts: i.volumeDrafts
                    };
                    return v.createVersion(o).then(function(e) {
                        if ("RUNNING" != t.config.deploymentStatus) r.alert("新建成功", "新建部署版本成功,当前状态不能升级。"),
                        n.resolve("create");
                        else {
                            s.open({
                                animation: !0,
                                templateUrl: "createVersionModal.html",
                                controller: "createVersionModalCtr",
                                size: "sm",
                                resolve: {
                                    replicas: function() {
                                        return t.config.currentReplicas
                                    }
                                }
                            }).result.then(function(i) {
                                v.updateDeploy(t.config.deployId, e.data.result, i).then(function() {
                                    r.alert("正在升级", "已提交，正在升级！"),
                                    n.resolve("update")
                                },
                                function(e) {
                                    1007 === e.data.resultCode ? r.
                                    continue ("警告！", "监听器状态异常，请点击确定进入详情页进行配置").then(function(e) {
                                        e === r.buttons.BUTTON_OK_ONLY && ($state.go("clusterDetail.watcher", {
                                            id: $scope.watcherInfo.clusterId
                                        }), hide())
                                    }) : r.error("升级失败！", e.data.resultMsg),
                                    n.resolve("updateFailed")
                                })
                            },
                            function() {
                                n.resolve("dismiss")
                            })
                        }
                    },
                    function(e) {
                        r.error("创建版本失败！", e.data.resultMsg),
                        n.reject("create")
                    }),
                    n.promise
                }
            },
            {
                key: "createWatcherVersion",
                value: function(e) {
                    var t = this,
                    n = l.defer();
                    return v.createVersion(e).then(function(e) {
                        if ("RUNNING" != t.config.deploymentStatus) r.alert("新建部署版本成功,当前状态不能升级。"),
                        n.resolve("create");
                        else {
                            s.open({
                                animation: !0,
                                templateUrl: "createVersionModal.html",
                                controller: "createWatcherVersionModalCtr",
                                size: "sm",
                                resolve: {
                                    replicas: function() {
                                        return t.config.currentReplicas
                                    }
                                }
                            }).result.then(function(i) {
                                v.updateDeploy(t.config.deployId, e.data.result, i).then(function() {
                                    r.alert("已提交，正在升级！"),
                                    n.resolve("update")
                                },
                                function(e) {
                                    r.error("升级失败", e.data.resultMsg),
                                    n.resolve("updateFailed")
                                })
                            },
                            function() {
                                n.resolve("dismiss")
                            })
                        }
                    },
                    function(e) {
                        r.error("创建版本失败", e.data.resultMsg),
                        n.reject("create")
                    }),
                    n.promise
                }
            },
            {
                key: "stop",
                value: function() {
                    return e.post("/api/deploy/action/stop?deployId=" + this.config.deployId)
                }
            },
            {
                key: "abort",
                value: function() {
                    return e.post("/api/deploy/action/abort?deployId=" + this.config.deployId)
                }
            },
            {
                key: "scaleForDaemonSet",
                value: function(t) {
                    var n = this,
                    i = l.defer();
                    return s.open({
                        animation: !0,
                        templateUrl: "scaleModalForDaemonSet.html",
                        controller: "scaleModalForDaemonSetCtr",
                        size: "md",
                        resolve: {
                            deployIns: function() {
                                return n
                            }
                        }
                    }).result.then(function(t) {
                        var o = "api/deploy/action/daemonset/scales?deployId=" + n.config.deployId + "&version=" + n.config.currentVersions[0].version;
                        e.post(o, t).then(function(e) {
                            r.alert("提示", "操作成功！"),
                            i.resolve(e.data.result)
                        },
                        function(e) {
                            1007 === e.data.resultCode ? r.
                            continue ("警告！", "监听器状态异常，请点击确定进入详情页进行配置").then(function(e) {
                                e === r.buttons.BUTTON_OK_ONLY && ($state.go("clusterDetail.watcher", {
                                    id: $scope.watcherInfo.clusterId
                                }), hide())
                            }) : r.error("警告", "请求失败！"),
                            i.reject("requestError")
                        })
                    },
                    function() {
                        i.reject("dismiss")
                    }),
                    i.promise
                }
            },
            {
                key: "scale",
                value: function(t) {
                    var n = this,
                    i = l.defer();
                    return s.open({
                        animation: !0,
                        templateUrl: "scaleModal.html",
                        controller: "ScaleModalCtr",
                        size: "md",
                        resolve: {
                            oldReplicas: function() {
                                return n.config.currentReplicas
                            }
                        }
                    }).result.then(function(t) {
                        if ((t = parseInt(t)) === n.config.currentReplicas) return r.error("警告", "实例个数无变化！"),
                        void i.reject();
                        var o = t > n.config.currentReplicas ? "api/deploy/action/scaleup": "api/deploy/action/scaledown";
                        e.post(o + "?deployId=" + n.config.deployId + "&replicas=" + t + "&version=" + n.config.currentVersions[0].version).then(function(e) {
                            r.alert("提示", "操作成功！"),
                            i.resolve(e.data.result)
                        },
                        function(e) {
                            1007 === e.data.resultCode ? r.
                            continue ("警告！", "监听器状态异常，请点击确定进入详情页进行配置").then(function(e) {
                                e === r.buttons.BUTTON_OK_ONLY && ($state.go("clusterDetail.watcher", {
                                    id: $scope.watcherInfo.clusterId
                                }), hide())
                            }) : r.error("警告", "请求失败！"),
                            i.reject("requestError")
                        })
                    },
                    function() {
                        i.reject("dismiss")
                    }),
                    i.promise
                }
            },
            {
                key: "recoverVersion",
                value: function() {
                    var e = this,
                    t = l.defer();
                    return s.open({
                        animation: !0,
                        templateUrl: "versionListModal.html",
                        controller: "VersionListModalCtr",
                        size: "md",
                        resolve: {
                            deployInfo: function() {
                                return e.config
                            }
                        }
                    }).result.then(function(n) {
                        v.rollbackDeploy(e.config.deployId, n.versionId, n.replicas).then(function(e) {
                            t.resolve(e.data.result)
                        },
                        function() {
                            t.reject()
                        })
                    },
                    function() {
                        t.reject("dismiss")
                    }),
                    t.promise
                }
            },
            {
                key: "updateVersion",
                value: function(e) {
                    var t = this,
                    n = l.defer();
                    return s.open({
                        animation: !0,
                        templateUrl: "versionListModal.html",
                        controller: "VersionListModalCtr",
                        size: "md",
                        resolve: {
                            deployInfo: function() {
                                return t.config
                            }
                        }
                    }).result.then(function(e) {
                        var i = t.config.currentVersions[0].version;
                        i === e.versionId ? (r.error("警告", "您不能选择当前版本！"), n.reject("dismiss")) : i > e.versionId ? v.rollbackDeploy(t.config.deployId, e.versionId, e.replicas).then(function(e) {
                            r.alert("提示", "已提交，正在回滚！"),
                            n.resolve(e.data.result)
                        },
                        function(e) {
                            1007 === e.data.resultCode ? r.
                            continue ("警告！", "监听器状态异常，请点击确定进入详情页进行配置").then(function(e) {
                                e === r.buttons.BUTTON_OK_ONLY && ($state.go("clusterDetail.watcher", {
                                    id: $scope.watcherInfo.clusterId
                                }), hide())
                            }) : r.error("警告", "回滚失败，请重试！"),
                            n.reject()
                        }) : v.updateDeploy(t.config.deployId, e.versionId, e.replicas).then(function(e) {
                            r.alert("提示", "已提交，正在升级！"),
                            n.resolve(e.data.result)
                        },
                        function(e) {
                            1007 === e.data.resultCode ? r.
                            continue ("警告！", "监听器状态异常，请点击确定进入详情页进行配置").then(function(e) {
                                e === r.buttons.BUTTON_OK_ONLY && ($state.go("clusterDetail.watcher", {
                                    id: $scope.watcherInfo.clusterId
                                }), hide())
                            }) : r.alert("提示", "升级失败，请重试！"),
                            n.reject()
                        })
                    },
                    function() {
                        n.reject("dismiss")
                    }),
                    n.promise
                }
            },
            {
                key: "startVersion",
                value: function() {
                    var e = this,
                    t = l.defer();
                    return s.open({
                        animation: !0,
                        templateUrl: "versionListModal.html",
                        controller: "VersionListModalCtr",
                        size: "md",
                        resolve: {
                            deployInfo: function() {
                                return e.config
                            }
                        }
                    }).result.then(function(n) {
                        v.startDeploy(e.config.deployId, n.versionId, n.replicas).then(function(e) {
                            t.resolve(e.data.result)
                        },
                        function() {
                            t.reject()
                        })
                    },
                    function() {
                        t.reject("dismiss")
                    }),
                    t.promise
                }
            },
            {
                key: "delete",
                value: function() {
                    return e.delete("/api/deploy/id/" + this.config.deployId)
                }
            },
            {
                key: "modifyDeploy",
                value: function() {
                    var e = this._formartDeploy();
                    return v.modifyDeploy(this.config.deployId, e)
                }
            },
            {
                key: "create",
                value: function() {
                    function t() {
                        e.post("api/deploy/create", angular.toJson(o)).then(function() {
                            i.resolve()
                        },
                        function(e) {
                            i.reject({
                                type: "create",
                                msg: e.data.resultMsg
                            })
                        })
                    }
                    var n = this,
                    i = l.defer(),
                    o = this._formartDeploy();
                    if (this.isNewNamespace) {
                        var r = this.config.namespace,
                        a = [r];
                        d.setNamespace(this.clusterListIns.cluster.id, a).then(function() {
                            n.toggleIsNewNamespace(),
                            n.namespaceList.push(r),
                            n.toggleNamespace(r),
                            t()
                        },
                        function(e) {
                            i.reject({
                                type: "namespace",
                                msg: e.data.resultMsg
                            })
                        })
                    } else t();
                    return i.promise
                }
            },
            {
                key: "getDeployStr",
                value: function(t) {
                    var n = this._formartDeploy();
                    return n.podSpecStr = "",
                    e.post("api/deploy/deploymentstr", angular.toJson(n))
                }
            }]),
            a
        } (),
        g = function() {
            function e(t) {
                _classCallCheck(this, e),
                this.isCheckAll = !1,
                this.isCheckAllContainer = !1,
                this.instanceList = [],
                this.containerList = [],
                this.selectedCount = 0,
                this.selectedContainerCount = 0,
                this.init(t)
            }
            return _createClass(e, [{
                key: "init",
                value: function(e) {
                    this.isCheckAll = !1,
                    this.isCheckAllContainer = !1,
                    this.instanceList = function() {
                        e = e || [];
                        var n = !0,
                        i = !1,
                        o = t;
                        try {
                            for (var r, a = e[Symbol.iterator](); ! (n = (r = a.next()).done); n = !0) {
                                var s = r.value;
                                if (s.isSelected = !1, s.keyFilter = !0, s.containers) {
                                    var l = !0,
                                    c = !1,
                                    u = t;
                                    try {
                                        for (var f, d = s.containers[Symbol.iterator](); ! (l = (f = d.next()).done); l = !0) {
                                            var h = f.value;
                                            h.shortContainerId = h.containerId.substring(0, 12)
                                        }
                                    } catch(e) {
                                        c = !0,
                                        u = e
                                    } finally {
                                        try { ! l && d.
                                            return && d.
                                            return ()
                                        } finally {
                                            if (c) throw u
                                        }
                                    }
                                }
                            }
                        } catch(e) {
                            i = !0,
                            o = e
                        } finally {
                            try { ! n && a.
                                return && a.
                                return ()
                            } finally {
                                if (i) throw o
                            }
                        }
                        return e
                    } ()
                }
            },
            {
                key: "toggleContainerList",
                value: function(e) {
                    this.isCheckAllContainer = !1,
                    this.selectedContainerCount = 0,
                    this.containerList = e.containers || [];
                    var n = !0,
                    i = !1,
                    o = t;
                    try {
                        for (var r, a = this.containerList[Symbol.iterator](); ! (n = (r = a.next()).done); n = !0) {
                            r.value.isSelected = !1
                        }
                    } catch(e) {
                        i = !0,
                        o = e
                    } finally {
                        try { ! n && a.
                            return && a.
                            return ()
                        } finally {
                            if (i) throw o
                        }
                    }
                }
            },
            {
                key: "filterWithKey",
                value: function(e) {
                    this.isCheckAll = !1,
                    this.selectedCount = 0;
                    var n = !0,
                    i = !1,
                    o = t;
                    try {
                        for (var r, a = this.instanceList[Symbol.iterator](); ! (n = (r = a.next()).done); n = !0) {
                            var s = r.value;
                            s.isSelected = !1,
                            s.keyFilter = s.instanceName.indexOf(e) !== -1
                        }
                    } catch(e) {
                        i = !0,
                        o = e
                    } finally {
                        try { ! n && a.
                            return && a.
                            return ()
                        } finally {
                            if (i) throw o
                        }
                    }
                }
            },
            {
                key: "toggleContainerCheck",
                value: function(e) {
                    var n = !0;
                    if (e.isSelected) {
                        this.selectedContainerCount++;
                        var i = !0,
                        o = !1,
                        r = t;
                        try {
                            for (var a, s = this.containerList[Symbol.iterator](); ! (i = (a = s.next()).done); i = !0) {
                                if (!a.value.isSelected) {
                                    n = !1;
                                    break
                                }
                            }
                        } catch(e) {
                            o = !0,
                            r = e
                        } finally {
                            try { ! i && s.
                                return && s.
                                return ()
                            } finally {
                                if (o) throw r
                            }
                        }
                        n && (this.isCheckAllContainer = !0)
                    } else this.selectedContainerCount--,
                    this.isCheckAllContainer = !1
                }
            },
            {
                key: "checkAllContainer",
                value: function(e) {
                    this.isCheckAllContainer = void 0 === e ? !this.isCheckAllContainer: e,
                    this.selectedContainerCount = this.isCheckAllContainer ? this.containerList.length: 0;
                    var n = !0,
                    i = !1,
                    o = t;
                    try {
                        for (var r, a = this.containerList[Symbol.iterator](); ! (n = (r = a.next()).done); n = !0) {
                            r.value.isSelected = this.isCheckAllContainer
                        }
                    } catch(e) {
                        i = !0,
                        o = e
                    } finally {
                        try { ! n && a.
                            return && a.
                            return ()
                        } finally {
                            if (i) throw o
                        }
                    }
                }
            },
            {
                key: "toggleCheck",
                value: function(e) {
                    var n = !0;
                    if (e.isSelected) {
                        this.selectedCount++;
                        var i = !0,
                        o = !1,
                        r = t;
                        try {
                            for (var a, s = this.instanceList[Symbol.iterator](); ! (i = (a = s.next()).done); i = !0) {
                                var l = a.value;
                                if (l.keyFilter && !l.isSelected) {
                                    n = !1;
                                    break
                                }
                            }
                        } catch(e) {
                            o = !0,
                            r = e
                        } finally {
                            try { ! i && s.
                                return && s.
                                return ()
                            } finally {
                                if (o) throw r
                            }
                        }
                        n && (this.isCheckAll = !0)
                    } else this.selectedCount--,
                    this.isCheckAll = !1
                }
            },
            {
                key: "checkAllInstance",
                value: function(e) {
                    this.isCheckAll = void 0 === e ? this.isCheckAll: e,
                    this.selectedCount = 0;
                    var n = !0,
                    i = !1,
                    o = t;
                    try {
                        for (var r, a = this.instanceList[Symbol.iterator](); ! (n = (r = a.next()).done); n = !0) {
                            var s = r.value;
                            s.keyFilter && this.isCheckAll ? (s.isSelected = !0, this.selectedCount++) : s.isSelected = !1
                        }
                    } catch(e) {
                        i = !0,
                        o = e
                    } finally {
                        try { ! n && a.
                            return && a.
                            return ()
                        } finally {
                            if (i) throw o
                        }
                    }
                }
            }]),
            e
        } (),
        p = function() {
            function e(t) {
                _classCallCheck(this, e),
                this.deploy = {},
                this.isLoading = !1,
                this.deployList = [],
                this.deployInstanceListIns = new g,
                this.init(t)
            }
            return _createClass(e, [{
                key: "init",
                value: function(e) {
                    this.deployList = e || []
                }
            },
            {
                key: "toggleDeploy",
                value: function(e, t, n, i, o) {
                    var r = this,
                    a = l.defer();
                    return e ? (this.deploy.id = e, this.deploy.name = t, this.deploy.namespace = n, this.isLoading = !0, i || (o && "deploy" !== o ? "loadBalance" === o && f.loadBalance.loadBalance.listInstance(e).then(function(e) {
                        r.deployInstanceListIns.init(e),
                        a.resolve()
                    }).
                    catch(function(e) {}).then(function() {
                        a.reject(),
                        r.isLoading = !1
                    }) : v.getInstances(e).then(function(e) {
                        r.deployInstanceListIns.init(e.data.result),
                        a.resolve()
                    }).
                    finally(function() {
                        a.reject(),
                        this.isLoading = !1
                    }))) : (this.deploy.id = null, this.deploy.name = null, this.deploy.namespace = null, this.deployInstanceListIns.init(), a.reject()),
                    a.promise
                }
            },
            {
                key: "filterDeploy",
                value: function(e, n, i) {
                    var o = void 0,
                    r = void 0,
                    a = void 0,
                    s = !0,
                    l = !1,
                    c = t;
                    try {
                        for (var u, f = this.deployList[Symbol.iterator](); ! (s = (u = f.next()).done); s = !0) {
                            var d = u.value;
                            d.clusterFilter = !e || d.clusterName === e,
                            d.hostFilter = !n || d.hostEnv === n,
                            void 0 === o && d.clusterFilter && d.hostFilter && (o = d.deployId, r = d.deployName, a = d.namespace)
                        }
                    } catch(e) {
                        l = !0,
                        c = e
                    } finally {
                        try { ! s && f.
                            return && f.
                            return ()
                        } finally {
                            if (l) throw c
                        }
                    }
                    return void 0 === o ? this.toggleDeploy() : this.toggleDeploy(o, r, a, "", i)
                }
            }]),
            e
        } (),
        m = a.instancesCreator({
            DeployList: p,
            Deploy: y
        });
        return {
            deployService: v,
            getInstance: m
        }
    }
    var i = angular.module("deployModule", []);
    n.$inject = ["$http", "$domeCluster", "$domeImage", "$domePublic", "dialog", "$domeModel", "$modal", "$q", "$util", "$sce", "api"],
    i.factory("$domeDeploy", n),
    e.deployModule = i
} (window);